﻿using MongoDB.Driver;
using System;
using System.Collections.Generic;
using System.Linq.Expressions;

namespace Doolin.MongoRepository.Commons
{
  public interface IMongoRepository
  {
    void Delete<T>(Expression<Func<T, bool>> expression) where T : IMongoEntity, new();
    T GetOne<T>(Expression<Func<T, bool>> expression) where T : IMongoEntity, new();
    List<T> GetMany<T>(Expression<Func<T, bool>> expression) where T : IMongoEntity, new();
    List<T> GetMany<T>(FilterDefinition<T> filter) where T : IMongoEntity, new();
    List<T> All<T>() where T : IMongoEntity, new();
    List<T> All<T>(int page, int pageSize) where T : IMongoEntity, new();
    T Add<T>(T item) where T : IMongoEntity, new();
    void Update<T>(Expression<Func<T, bool>> expression, UpdateDefinition<T> update, bool upsert) where T : IMongoEntity, new();
    void Update<T>(FilterDefinition<T> filter, UpdateDefinition<T> update, bool upsert) where T : IMongoEntity, new();
    void Update<T>(T item) where T : IMongoEntity, new();
    long AddRange<T>(IEnumerable<T> items) where T : IMongoEntity, new();
    long Count<TEntity>(FilterDefinition<TEntity> filter) where TEntity : IMongoEntity, new();
    IMongoCollection<TEntity> GetCollection<TEntity>() where TEntity : IMongoEntity, new();
  }
}
